/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package common.model.message;

import common.model.Visitor;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;

/**
 *
 * @author nicolas
 */
public class UserDepartedMessage extends AbstractVisitorBasedMessage {

    @Override
    public String messageToString() {
        return "DEPARTED " + this.getVisitor().getUserName();
    }

   
    public UserDepartedMessage(Visitor visitor) {
        super(visitor);
    }

    /**
     * Constructor 
     * Unmarshalling constructor
     * @param line
     */
    public UserDepartedMessage(String line) {
        super();
        StringTokenizer st = new StringTokenizer(line, " ");
        List<Object> listElems = new ArrayList();
        while (st.hasMoreElements()) {
            listElems.add(st.nextElement());
        }
        this.getVisitor().setUserName((String) listElems.get(1));
    }
}
